fix: add content-type check for non-JSON responses in HttpClient#826
Merged
Conversation
Co-authored-by: Copilot <copilot@github.com>
Pavan-Microsoft
temporarily deployed
to
production
April 23, 2026 09:40 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a defensive Content-Type validation to avoid attempting response.json() on non-JSON responses, improving runtime safety when calling external endpoints.
Changes:
- Added a
Content-Typeheader check inHttpClient.fetchExternal()to ensure responses are JSON before parsing. - Throws a clearer early error when a non-JSON response is received.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pavan-Microsoft
temporarily deployed
to
production
April 23, 2026 10:01 — with
GitHub Actions
Inactive
Pavan-Microsoft
marked this pull request as ready for review
April 23, 2026 10:03
Pavan-Microsoft
requested review from
Avijit-Microsoft,
Prajwal-Microsoft,
Roopan-Microsoft,
Vinay-Microsoft,
aniaroramsft,
malrose07,
nchandhi and
toherman-msft
as code owners
April 23, 2026 10:03
Pavan-Microsoft
temporarily deployed
to
production
April 23, 2026 10:03 — with
GitHub Actions
Inactive
Avijit-Microsoft
approved these changes
Apr 23, 2026
Contributor
|
🎉 This PR is included in version 2.4.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request adds an extra validation step to the
HttpClientutility to ensure that all HTTP responses are in JSON format before attempting to parse them. This helps prevent runtime errors when the server returns unexpected content types.Error handling improvements:
HttpClient(src/App/src/utils/httpClient.ts) to verify that the response'sContent-Typeheader includesapplication/json, throwing an error if a non-JSON response is received.Does this introduce a breaking change?
Golden Path Validation
Deployment Validation